package com.group.finance.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.group.finance.entity.Balance;
import com.group.finance.dao.BalanceMapper;
import com.group.finance.entity.Deal;
import com.group.finance.service.IBalanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zgc
 * @since 2022-06-07
 */
@Service
public class BalanceServiceImpl extends ServiceImpl<BalanceMapper, Balance> implements IBalanceService {

    @Resource
    private BalanceMapper balanceMapper;

    @Override
    public List<Balance> findAllBalance(int current, int size) {

        QueryWrapper<Balance> wrapper = new QueryWrapper();

        Page<Balance> page = new Page<>(current,size);

        IPage<Balance> balanceIPage = balanceMapper.selectPage(page, wrapper);


        System.out.println("总页数"+balanceIPage.getPages());
        System.out.println("总记录数"+balanceIPage.getTotal());

        List<Balance> balanceList = balanceIPage.getRecords();

        return balanceList;
    }
}
